// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import FastClick from 'fastclick'
import flexible from 'amfe-flexible'
import VueRouter from 'vue-router'
import VueLocalStorage from 'vue-ls'
import App from '@/App'
// 这里获取router下的index.js的路由
import routes from '@/router'
import routerHook from '@/router/hook'

// vux global plugins
import { ToastPlugin } from 'vux'

Vue.use(VueRouter)
Vue.use(VueLocalStorage)

Vue.use(ToastPlugin)

const routerInstance = new VueRouter({
	mode: 'history',
	base: '/',
  routes
})

const router = routerHook(routerInstance) // 全局路由钩子

FastClick.attach(document.body)

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  router,
  render: h => h(App)
}).$mount('#app-box')

export default router
